IProducerConsumerCollection(T).TryAdd Method

Task Parallel System.Threading

Attempts to add an object to the ConcurrentBag<(Of <(T>)>).

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Private Function TryAdd ( _
	item As T _
) As Boolean Implements IProducerConsumerCollection(Of T).TryAdd
C#
bool IProducerConsumerCollection<T>.TryAdd(
	T item
)

Parameters

item
Type: T
The object to be added to the ConcurrentBag<(Of <(T>)>). The value can be a null reference (Nothing in Visual Basic) for reference types.

Return Value

Always returns true

Implements

IProducerConsumerCollection<(Of <(T>)>)..::.TryAdd(T)

See Also